package com.yt.dao;

import com.yt.entity.Storage;
import org.apache.ibatis.annotations.*;

/**
 * @Classname StorageDao
 * @Description
 * @Date 2021/11/3 10:18
 * @Create by 杨涛
 */
@Mapper
public interface StorageDao {

    @Results(id = "storageMap",value = {
            @Result(id = true,column ="id" ,property ="id" ),
            @Result( column ="product_id" ,property ="productId" ),
            @Result( column ="total" ,property ="total" ),
            @Result( column ="used" ,property ="used" ),
            @Result( column ="residue" ,property ="residue" )
    } )
    @Select("select * from t_storage where product_id =#{productId}")
    Storage getStorageByPid(@Param("productId") Long productId );
    @Update("UPDATE `t_storage` SET `total` = #{total},`used` = #{used},`residue`=#{residue} WHERE `product_id`= #{productId};")
    void updateStorage(Storage storage);
}
